From f7a13a0436badbf46be38c5b578b8543c7743d07 Mon Sep 17 00:00:00 2001
From: Lauri Vuorela <lauri.vuorela@gmail.com>
Date: Tue, 13 Feb 2024 20:35:57 +0100
Subject: Round totals rather than expense by expense (#88)

* do balance rounding only on full balances rather than on every expense

* use "public balances" calculated from reimbursements to show on balance page

* fixes for totals that did not work as expected

* prettier
---
 src/app/groups/[groupId]/balances/page.tsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/app/groups/[groupId]/balances/page.tsx')

diff --git a/src/app/groups/[groupId]/balances/page.tsx b/src/app/groups/[groupId]/balances/page.tsx
index b35a379..93223a4 100644
--- a/src/app/groups/[groupId]/balances/page.tsx
+++ b/src/app/groups/[groupId]/balances/page.tsx
@@ -9,7 +9,11 @@ import {
   CardTitle,
 } from '@/components/ui/card'
 import { getGroupExpenses } from '@/lib/api'
-import { getBalances, getSuggestedReimbursements } from '@/lib/balances'
+import {
+  getBalances,
+  getPublicBalances,
+  getSuggestedReimbursements,
+} from '@/lib/balances'
 import { Metadata } from 'next'
 import { notFound } from 'next/navigation'
 
@@ -28,6 +32,7 @@ export default async function GroupPage({
   const expenses = await getGroupExpenses(groupId)
   const balances = getBalances(expenses)
   const reimbursements = getSuggestedReimbursements(balances)
+  const publicBalances = getPublicBalances(reimbursements)
 
   return (
     <>
@@ -40,7 +45,7 @@ export default async function GroupPage({
         </CardHeader>
         <CardContent>
           <BalancesList
-            balances={balances}
+            balances={publicBalances}
             participants={group.participants}
             currency={group.currency}
           />
-- 
cgit v1.3

